package com.mindata.blockchain.socket.pbft.listener;

import com.mindata.blockchain.block.block.BaseBlock;
import com.mindata.blockchain.block.block.Block;
import com.mindata.blockchain.socket.common.event.IntroAddBlockEvent;
import com.mindata.blockchain.socket.common.queue.IntroAddBlockQueue;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class IntroAddBlockListener {
    @Resource
    IntroAddBlockQueue introAddBlockQueue;

    @EventListener
    public void Process(IntroAddBlockEvent introAddBlockEvent) {
        BaseBlock baseBlock = (BaseBlock) introAddBlockEvent.getSource();
        introAddBlockQueue.push(baseBlock);
    }
}
